package org.nerve.tinker.rpc.component;

import org.apache.thrift.TException;
import org.nerve.tinker.rpc.TinkerRequest;
import org.nerve.tinker.rpc.TinkerResponse;
import org.nerve.tinker.rpc.TinkerService;

import java.util.function.Consumer;

/**
 * com.zeus.dpos.rpc.component
 * Created by zengxm on 2016/4/30.
 */
public abstract class CommonServiceImpl implements TinkerService.Iface {

	@Override
	public abstract TinkerResponse action(TinkerRequest req) throws TException;

	/**
	 *
	 * @param req
	 * @param reqCon
	 * @return
	 */
	public TinkerResponse response(TinkerRequest req, Consumer<TinkerResponse> reqCon){
		TinkerResponse response=new TinkerResponse();
		reqCon.accept(response);
		return response;
	}
}
